package leetcode.code1529;

import leetcode.helper.H;

public class Solution {

	public int minFlips(String target) {
		int p = 0, ans = 0, len = target.length();
		while (p < len && target.charAt(p) == '0') {
			p++;
		}
		while (p < len) {
			ans++;
			p++;
			while (p < len && target.charAt(p) == target.charAt(p - 1)) {
				p++;
			}
		}
		return ans;
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.minFlips("100011100001110000111100001111000");
	}

}
